Windows: Update how gtk-win32.rc is generated
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 22 Feb 2016 09:38:15 +0000 (17:38 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 22 Feb 2016 09:40:17 +0000 (17:40 +0800)
On Visual Studio, unlike MinGW, manifest files are embedded via
including the manifest file as a resource file in the projects, not
via the .rc file.  This means that the line in the .rc file that
specifies the manifest file would cause trouble, so that line gets
removed when the full gtk3-win32.rc is generated on Visual Studio builds,
otherwise 2010+ Visual Studio will complain when compiling the .rc file.
Also, the inclusion of winuser.h will cause warnings during the
compilation of the .rc file.

Fix this by isolating the Win32 resource portions of gtk-win32.rc.in to
gtk-win32.rc.body.in and:
-On MinGW, construct the full gtk-win32.rc by doing the winver.h and
 winuser.h inclusion first, then append the contents of gtk-win32.rc.body,
 and then appending the line to embed the manifest file.
-On Visual Studio, simply copy the gtk-win32.rc.body to gtk-win32.rc,
 and generate the full libgtk3.manifest file.

https://bugzilla.gnome.org/show_bug.cgi?id=762311

12 files changed:
build/win32/Makefile.am
build/win32/process-in-win32.py [deleted file]
build/win32/replace.py [new file with mode: 0644]
build/win32/vs10/gtk-3.vcxproj.filtersin
build/win32/vs10/gtk-3.vcxprojin
build/win32/vs10/gtk3-gen-srcs.props
build/win32/vs10/gtk3-gen-srcs.vsprops [new file with mode: 0644]
build/win32/vs9/gtk-3.vcprojin
configure.ac
gtk/Makefile.am
gtk/gtk-win32.rc.body.in [new file with mode: 0644]
gtk/gtk-win32.rc.in [deleted file]

index e235327f03218b6460092ebd6d71e51584c62e81..9fa15e824bd32c062ec7edc98f20a180568e1530 100644 (file)
@@ -8,6 +8,6 @@ SUBDIRS =       \
        vs12    \
        vs14
 
-EXTRA_DIST += process-in-win32.py
+EXTRA_DIST += replace.py
 
 -include $(top_srcdir)/git.mk
diff --git a/build/win32/process-in-win32.py b/build/win32/process-in-win32.py
deleted file mode 100644 (file)
index 86be09a..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/python
-# vim: encoding=utf-8
-# expand Windows-specific *.in files
-# for Visual Studio Builds
-
-import os
-import sys
-import re
-import string
-import argparse
-
-
-def open_compat(src, mode):
-    if (sys.version_info.major < 3):
-        return open(src, mode)
-    else:
-        return open(src, mode, encoding='utf-8', errors='surrogateescape')
-
-def get_version(srcroot):
-    ver = {}
-    RE_VERSION = re.compile(r'^m4_define\(\[(gtk_\w+)\],\s*\[(\d+)\]\)')
-    RE_FLOAT_VERSION = re.compile(r'^m4_define\(\[(gtk_\w+)\],\s*\[(\d+\.\d*)\]\)')
-    with open(os.path.join(srcroot, 'configure.ac'), 'r') as ac:
-        for i in ac:
-            mo = RE_VERSION.search(i)
-            if mo:
-                ver[mo.group(1).upper()] = int(mo.group(2))
-            mo = RE_FLOAT_VERSION.search(i)
-            if mo:
-                ver[mo.group(1).upper()] = float(mo.group(2))
-
-    ver['GTK_BINARY_AGE'] = 100 * ver['GTK_MINOR_VERSION'] + ver['GTK_MICRO_VERSION']
-    ver['GTK_VERSION'] = '%d.%d.%d' % (ver['GTK_MAJOR_VERSION'],
-                                        ver['GTK_MINOR_VERSION'],
-                                        ver['GTK_MICRO_VERSION'])
-    ver['LT_RELEASE'] = '%d.%d' % (ver['GTK_MAJOR_VERSION'], ver['GTK_MINOR_VERSION'])
-    ver['LT_CURRENT'] = 100 * \
-                        ver['GTK_MINOR_VERSION'] + \
-                        ver['GTK_MICRO_VERSION'] - \
-                        ver['GTK_INTERFACE_AGE']
-    ver['LT_REVISION'] = ver['GTK_INTERFACE_AGE']
-    ver['LT_AGE'] = ver['GTK_BINARY_AGE'] - ver['GTK_INTERFACE_AGE']
-    ver['LT_CURRENT_MINUS_AGE'] = ver['LT_CURRENT'] - ver['LT_AGE']
-    return ver
-
-def process_in(src, dest, vars):
-    RE_VARS = re.compile(r'@(\w+?)@')
-
-    with open_compat(src, 'r') as s:
-        with open_compat(dest, 'w') as d:
-            for i in s:
-                i = RE_VARS.sub(lambda x: str(vars[x.group(1)]), i)
-                d.write(i)
-
-def get_srcroot():
-    if not os.path.isabs(__file__):
-        path = os.path.abspath(__file__)
-    else:
-        path = __file__
-    dirname = os.path.dirname(path)
-    return os.path.abspath(os.path.join(dirname, '..', '..'))
-
-def main(argv):
-    prog_desc = 'Create Various autogenerated Win32-specific Source Files'
-    parser = argparse.ArgumentParser(description=prog_desc)
-    parser.add_argument('--gtkwin32rc', dest='gtkwin32rc', action='store_const',
-                        const=1,
-                        help='Generate gtk-win32.rc')
-
-    parser.add_argument('--gtk3manifest', dest='gtk3manifest', action='store_const',
-                   const=1,
-                   help='Generate libgtk3.manifest')
-
-    args = parser.parse_args()
-    no_args = True
-
-    if args.gtkwin32rc is not None:
-        srcroot = get_srcroot()
-
-        ver = get_version(srcroot)
-
-        target = os.path.join(srcroot, 'gtk', 'gtk-win32.rc')
-        process_in(os.path.join(srcroot, 'gtk', 'gtk-win32.rc.in'),
-                   target + '.intermediate',
-                   ver)
-        fp_r = open_compat(target + '.intermediate', 'r')
-        lines = fp_r.readlines()
-        fp_r.close()
-        fp_w = open_compat(target, 'w')
-        fp_w.writelines([item for item in lines[:-1]])
-
-        fp_w.close()
-        os.unlink(target + '.intermediate')
-
-        no_args = False
-
-    if args.gtk3manifest is not None:
-        manifest = {}
-        manifest['EXE_MANIFEST_ARCHITECTURE'] = '*'
-        process_in(os.path.join(srcroot, 'gtk', 'libgtk3.manifest.in'),
-                   os.path.join(srcroot, 'gtk', 'libgtk3.manifest'),
-                   manifest)
-        no_args = False
-
-    if no_args is True:
-        raise SystemExit('Action argument required.  Please see %s --help for details.' % __file__)
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/build/win32/replace.py b/build/win32/replace.py
new file mode 100644 (file)
index 0000000..69ef417
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Simple utility script to manipulate
+# certain types of strings in a file
+
+# This can be used in various projects where
+# there is the need to replace strings in files,
+# and is copied from GLib's $(srcroot)/build/win32
+
+# Author: Fan, Chun-wei
+# Date: September 03, 2014
+
+import os
+import sys
+import re
+import string
+import argparse
+
+valid_actions = ['remove-prefix',
+                 'replace-var',
+                 'replace-str',
+                 'remove-str']
+
+def replace(src, dest, instring, outstring):
+    with open(src, 'r') as s:
+        with open(dest, 'w') as d:
+            for line in s:
+                i = line.replace(instring, outstring)
+                d.write(i)
+
+def check_required_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is None:
+            raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
+
+def warn_ignored_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is not None:
+            print('%s: warning: --%s argument is ignored' % (__file__, param))
+
+def main(argv):
+
+    parser = argparse.ArgumentParser(description='Process strings in a file.')
+    parser.add_argument('-a',
+                        '--action',
+                        help='Action to carry out.  Can be one of:\n'
+                             'remove-prefix\n'
+                             'replace-var\n'
+                             'replace-str\n'
+                             'remove-str',
+                        choices=valid_actions)
+    parser.add_argument('-i', '--input', help='Input file')
+    parser.add_argument('-o', '--output', help='Output file')
+    parser.add_argument('--instring', help='String to replace or remove')
+    parser.add_argument('--var', help='Autotools variable name to replace')
+    parser.add_argument('--outstring',
+                        help='New String to replace specified string or variable')
+    parser.add_argument('--removeprefix', help='Prefix of string to remove')
+
+    args = parser.parse_args()
+
+    input_string = ''
+    output_string = ''
+
+    # We must have action, input, output for all operations
+    check_required_args(args, ['action','input','output'])
+
+    # Build the arguments by the operation that is to be done,
+    # to be fed into replace()
+
+    # Get rid of prefixes from a string
+    if args.action == 'remove-prefix':
+        check_required_args(args, ['instring','removeprefix'])
+        warn_ignored_args(args, ['outstring','var'])
+        input_string = args.removeprefix + args.instring
+        output_string = args.instring
+
+    # Replace an m4-style variable (those surrounded by @...@)
+    if args.action == 'replace-var':
+        check_required_args(args, ['var','outstring'])
+        warn_ignored_args(args, ['instring','removeprefix'])
+        input_string = '@' + args.var + '@'
+        output_string = args.outstring
+
+    # Replace a string
+    if args.action == 'replace-str':
+        check_required_args(args, ['instring','outstring'])
+        warn_ignored_args(args, ['var','removeprefix'])
+        input_string = args.instring
+        output_string = args.outstring
+
+    # Remove a string
+    if args.action == 'remove-str':
+        check_required_args(args, ['instring'])
+        warn_ignored_args(args, ['var','outstring','removeprefix'])
+        input_string = args.instring
+        output_string = ''
+
+    replace(args.input, args.output, input_string, output_string)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
index aefeb4531bf4f013134e4380740715a0bfd6a145..319d20ab011edacbadd57c0f7fede8dc28e8805a 100644 (file)
@@ -19,7 +19,8 @@
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
-    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in"><Filter>Resource Files</Filter></CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body"><Filter>Resource Files</Filter></CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in"><Filter>Resource Files</Filter></CustomBuild>
   </ItemGroup>
   <ItemGroup>
 #include "gtk-3.vs10.sourcefiles.filters"
index b8031d6fc62cd506ac09e1e7d089d79525e3c142..f159c5e841e9cb139d83c60cf0912c7c81e904b2 100644 (file)
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkDbusBuiltSources)</Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
     </CustomBuild>
-    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in">
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying GTK+ Win32 Version Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CopyGtkWin32RC)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying GTK+ Win32 Version Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CopyGtkWin32RC)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying GTK+ Win32 Version Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CopyGtkWin32RC)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying GTK+ Win32 Version Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(CopyGtkWin32RC)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
     </CustomBuild>
   </ItemGroup>
   <ItemGroup>
index 41c68eb03c01d8f0ea5bc0035b277bc49d1811ac..b9440c83b66fa24eecd37c458548f7ada3904a7e 100644 (file)
@@ -64,7 +64,8 @@ $(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix
 
 cd $(SolutionDir)
     </GenerateGtkDbusBuiltSources>
-    <GenerateGtkWin32RC>$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest</GenerateGtkWin32RC>
+    <CopyGtkWin32RC>copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc</CopyGtkWin32RC>
+    <GenerateGtkWin32Manifest>$(PythonPath)\python ..\replace.py --action=replace-var --input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest --var=EXE_MANIFEST_ARCHITECTURE --outstring=*</GenerateGtkWin32Manifest>
     <CopyDemosH>copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h</CopyDemosH>
   </PropertyGroup>
   <PropertyGroup>
@@ -83,8 +84,11 @@ cd $(SolutionDir)
     <BuildMacro Include="GenerateGtkDbusBuiltSources">
       <Value>$(GenerateGtkDbusBuiltSources)</Value>
     </BuildMacro>
-    <BuildMacro Include="GenerateGtkWin32RC">
-      <Value>$(GenerateGtkWin32RC)</Value>
+    <BuildMacro Include="CopyGtkWin32RC">
+      <Value>$(CopyGtkWin32RC)</Value>
+    </BuildMacro>
+    <BuildMacro Include="GenerateGtkWin32Manifest">
+      <Value>$(GenerateGtkWin32Manifest)</Value>
     </BuildMacro>
     <BuildMacro Include="CopyDemosH">
       <Value>$(CopyDemosH)</Value>
diff --git a/build/win32/vs10/gtk3-gen-srcs.vsprops b/build/win32/vs10/gtk3-gen-srcs.vsprops
new file mode 100644 (file)
index 0000000..88bb982
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="gtk3gensrcsprops"
+       InheritedPropertySheets=".\gtk3-build-defines.vsprops"
+       >
+       <UserMacro
+               Name="GenConfigH"
+               Value="
+copy ..\..\..\config.h.win32 ..\..\..\config.h
+                     "
+       />
+       <UserMacro
+               Name="GenGdkConfigHWin32"
+               Value="
+if exist ..\..\..\MSVC_$(ConfigurationName) goto DONE_GDKCONFIG_H&#x0D;&#x0A;
+
+if exist ..\..\..\gdk\gdkconfig.h del ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+if exist ..\..\..\GDK_BROADWAY_BUILD del ..\..\..\GDK_BROADWAY_BUILD&#x0D;&#x0A;
+if exist ..\..\..\MSVC_$(ConfigurationName)_Broadway del ..\..\..\MSVC_$(ConfigurationName)_Broadway&#x0D;&#x0A;
+
+if exist $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll del $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll&#x0D;&#x0A;
+if exist $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib del $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib&#x0D;&#x0A;
+
+if &quot;$(ConfigurationName)&quot; == &quot;Release&quot; del ..\..\..\MSVC_Debug&#x0D;&#x0A;
+if &quot;$(ConfigurationName)&quot; == &quot;Debug&quot; del ..\..\..\MSVC_Release&#x0D;&#x0A;
+
+copy ..\..\..\gdk\gdkconfig.h.win32 ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+copy ..\..\..\gdk\gdkconfig.h.win32 ..\..\..\GDK_WIN32ONLY_BUILD&#x0D;&#x0A;
+
+echo $(ConfigurationName) &gt; ..\..\..\MSVC_$(ConfigurationName)&#x0D;&#x0A;
+:DONE_GDKCONFIG_H&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="GenGdkConfigHBroadway"
+               Value="
+if exist ..\..\..\MSVC_$(ConfigurationName)_Broadway goto DONE_GDKCONFIG_H&#x0D;&#x0A;
+
+if exist ..\..\..\gdk\gdkconfig.h del ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+if exist ..\..\..\GDK_WIN32ONLY_BUILD del ..\..\..\GDK_WIN32ONLY_BUILD&#x0D;&#x0A;
+
+if exist ..\..\..\MSVC_Release del ..\..\..\MSVC_Release&#x0D;&#x0A;
+if exist ..\..\..\MSVC_Debug del ..\..\..\MSVC_Debug&#x0D;&#x0A;
+
+if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; del ..\..\..\MSVC_Debug_Broadway&#x0D;&#x0A;
+if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; del ..\..\..\MSVC_Release_Broadway&#x0D;&#x0A;
+
+copy ..\..\..\gdk\gdkconfig.h.win32_broadway ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+copy ..\..\..\gdk\gdkconfig.h.win32_broadway ..\..\..\GDK_BROADWAY_BUILD&#x0D;&#x0A;
+
+echo $(ConfigurationName) &gt; ..\..\..\MSVC_$(ConfigurationName)_Broadway&#x0D;&#x0A;
+:DONE_GDKCONFIG_H&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="GenerateGtkDbusBuiltSources"
+               Value="
+cd ..\..\..\gtk&#x0D;&#x0A;
+$(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml&#x0D;&#x0A;
+cd $(SolutionDir)&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="CopyGtkWin32RC"
+               Value="copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc"
+       />
+       <UserMacro
+               Name="GenerateGtkWin32Manifest"
+               Value="$(PythonPath)\python ..\replace.py --action=replace-var --input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest --var=EXE_MANIFEST_ARCHITECTURE --outstring=*"
+       />
+       <UserMacro
+               Name="CopyDemosH"
+               Value="copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h"
+       />
+</VisualStudioPropertySheet>
index 24b4fe4be0cf04d2a7a992a583c85b73fcb90878..b2dd357b6db51223b4ffac422ce8a69e4a23218a 100644 (file)
                                        />
                                </FileConfiguration>
                        </File>
-                       <File RelativePath="..\..\..\gtk\gtk-win32.rc.in">
+                       <File RelativePath="..\..\..\gtk\gtk-win32.rc.body">
                                <FileConfiguration Name="Debug|Win32">
                                <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Release|Win32">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Debug|x64">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Release|x64">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File RelativePath="..\..\..\gtk\libgtk3.manifest.in">
+                               <FileConfiguration Name="Debug|Win32">
+                               <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Release|Win32">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Debug|x64">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Release|x64">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
                                        />
                                </FileConfiguration>
                        </File>
index ae139e860be78977fbf94839f45413a012483d42..e97cb25671c18e72030ff14e8c76c35e2e63e903 100644 (file)
@@ -1943,7 +1943,7 @@ gdk/gdkversionmacros.h
 gtk/Makefile
 gtk/makefile.msc
 gtk/gtkversion.h
-gtk/gtk-win32.rc
+gtk/gtk-win32.rc.body
 gtk/libgtk3.manifest
 libgail-util/Makefile
 modules/Makefile
index 08062464dbc9e2e980437c878d23fad0171306a7..45f862a7610e6a55a98318c167d8d8d17d6fdefb 100644 (file)
@@ -35,6 +35,11 @@ gtk_win32_res_ldflag = -Wl,gtk-win32-res.o
 gtk-win32-res.o : gtk-win32.rc libgtk3.manifest
        $(WINDRES) gtk-win32.rc $@
 
+gtk-win32.rc: gtk-win32.rc.body
+       echo "#include <winuser.h>" >>$@
+       cat $< >>$@
+       echo "ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest" >>$@
+
 gtk.def: libgtk-3.la
        echo "LIBRARY libgtk-$(GTK_MAJOR_VERSION)-@LT_CURRENT_MINUS_AGE@" >$@
        echo "EXPORTS" >>$@
@@ -1124,6 +1129,10 @@ MAINTAINERCLEANFILES = \
 
 DISTCLEANFILES =
 
+if OS_WIN32
+DISTCLEANFILES += gtk-win32.rc
+endif
+
 EXTRA_DIST += $(gtk_all_private_h_sources) $(gtk_extra_sources)
 EXTRA_DIST += $(gtk_built_sources)
 
@@ -1587,7 +1596,8 @@ EXTRA_DIST +=                   \
        deprecated/Makefile.inc \
        inspector/Makefile.inc  \
        libgtk3.manifest.in     \
-       gtk-win32.rc.in         \
+       gtk-win32.rc.body.in    \
+       gtk-win32.rc.body       \
        gtkwin32embed.h         \
        gtkwin32embedwidget.h   \
        gtkwin32embedwidget.c   \
diff --git a/gtk/gtk-win32.rc.body.in b/gtk/gtk-win32.rc.body.in
new file mode 100644 (file)
index 0000000..4a42d5a
--- /dev/null
@@ -0,0 +1,30 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+  FILEVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
+  PRODUCTVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
+  FILEFLAGSMASK 0
+  FILEFLAGS 0
+  FILEOS VOS__WINDOWS32
+  FILETYPE VFT_DLL
+  FILESUBTYPE VFT2_UNKNOWN
+  BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+      BLOCK "040904B0"
+      BEGIN
+       VALUE "CompanyName", "The GTK developer community"
+       VALUE "FileDescription", "GIMP Toolkit"
+       VALUE "FileVersion", "@GTK_VERSION@.0"
+       VALUE "InternalName", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
+       VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
+       VALUE "OriginalFilename", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
+       VALUE "ProductName", "GTK+"
+       VALUE "ProductVersion", "@GTK_VERSION@"
+      END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+      VALUE "Translation", 0x409, 1200
+    END
+  END
diff --git a/gtk/gtk-win32.rc.in b/gtk/gtk-win32.rc.in
deleted file mode 100644 (file)
index e58d55a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <winver.h>
-#include <winuser.h>
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
-  PRODUCTVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
-  FILEFLAGSMASK 0
-  FILEFLAGS 0
-  FILEOS VOS__WINDOWS32
-  FILETYPE VFT_DLL
-  FILESUBTYPE VFT2_UNKNOWN
-  BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-      BLOCK "040904B0"
-      BEGIN
-       VALUE "CompanyName", "The GTK developer community"
-       VALUE "FileDescription", "GIMP Toolkit"
-       VALUE "FileVersion", "@GTK_VERSION@.0"
-       VALUE "InternalName", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
-       VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
-       VALUE "OriginalFilename", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
-       VALUE "ProductName", "GTK+"
-       VALUE "ProductVersion", "@GTK_VERSION@"
-      END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-      VALUE "Translation", 0x409, 1200
-    END
-  END
-ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest